<?php
////////////////////////////////////////////////////////////////////////////////
//   Copyright (C) ReloadCMS Development Team                                 //
//   http://reloadcms.sf.net                                                  //
//                                                                            //
//   This program is distributed in the hope that it will be useful,          //
//   but WITHOUT ANY WARRANTY, without even the implied warranty of           //
//   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.                     //
//                                                                            //
//   This product released under GNU General Public License v2                //
////////////////////////////////////////////////////////////////////////////////
$frm =new InputForm ('', 'post', __('Submit'));
$frm->addbreak(__('Banners management'));
$banners_path=DATA_PATH.'banners/';
$count=0;
$bbns=rcms_scandir($banners_path);
if (isset($_POST['newbanner']))
{
if ($_POST['newbanner']!='')
    {
      file_put_contents($banners_path.(sizeof($bbns)+1), $_POST['newbanner']);
    }
}
$bbns=rcms_scandir($banners_path);
// draw interface
foreach($bbns as $banner)
{
$count++;
$bannercode=file_get_contents($banners_path.$banner);
$frm->addrow(__('Banner code'), $frm->textarea($banner,$bannercode, 60));
}

// new banner insertion code
$frm->addrow(__('New banner code'), $frm->textarea('newbanner','', 60));
$frm->show();
?>
